def inp():
    n = int(input())
    data = input()
    data_l = []
    temp = ''
    for i in data:
        if i != ' ':
            temp += i
        else:
            data_l.append(int(temp))
            temp = ''
    data_l.append(int(temp))
    return n,data_l[:]


def traversal(data_l):
    s = 0
    for i in range(0,len(data_l)):
        for j in range(i + 1,len(data_l)):
            if data_l[i] > data_l[j]:
                s += 1
    return s

def main():
    n,data_l = inp()
    print(traversal(data_l))
    
main()